<?php
require_once "ModelBase.php";

class Perms extends TTEvent_Table_Abstract
{
	protected $_name = 'tamtay_role_permission';
	protected $_primary = 'rid';
	
	public function getUserPermissions($uid, $rids)
	{
		if (count($rids)==0)
		{
			return array();
		}
		
		$in="";
		for ($i=0; $i<count($rids); $i++)
		{
			if ($in!="")
			{
				$in = $in . ", ";
			}
			$in = $in . $rids[$i];
		}
		$in="(" . $in . ")";
		
		$sql="SELECT DISTINCT p.perm FROM tamtay_role r INNER JOIN tamtay_role_permission p ON p.rid = r.rid WHERE r.rid IN " . $in;
		return $this->execSelectQuery($sql);
	}
}

